package pl.skubicha.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import pl.skubicha.domain.Groups;

public interface GroupRepository extends JpaRepository< Groups, Integer > {

	public final static String FIND_BY_SEARCHSTRING_QUERY = "SELECT g FROM Groups g WHERE g.groupName like :searchString or g.numericGroupName like :searchString";

	@Query( FIND_BY_SEARCHSTRING_QUERY )
	public Page< Groups > findAllMatching( @Param( "searchString" ) String searchString, Pageable page );
}
